package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.entity.User2;
import com.example.demo.mapper.UserMapper;
import com.example.demo.mapper.User2Mapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
//@RequestMapping("/user")
public class UserController {

    @Resource
    private UserMapper userMapper;

    @Resource
    private User2Mapper user2Mapper;

//    @GetMapping
    @GetMapping("/user")
    // http://localhost:9090/user
    public List<User> findAll() {
        System.out.println("user findAll");
        return userMapper.selectAll();
    }

//    @GetMapping
    @GetMapping("/user2")
    // http://localhost:9090/user2
    public List<User2> findUser() {
        System.out.println("user findUser");
        user2Mapper.
        return user2Mapper.selectList(null);
    }

}